-
Notifications
You must be signed in to change notification settings - Fork 30
Introduce Ractor benchmarks and harness #375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
9a48fe5 to
607cd5b
Compare
910d5f9 to
c1c1654
Compare
40880ac to
fe13558
Compare
7841bf9 to
78f97ef
Compare
|
This looks good to me, but I feel I'm missing something. Are the bechmarks just copied fully in to |
|
Some benchmark directories were copied into |
Got it, makes sense.
If they're not buying us anything, I think we should remove them. They look like possible benchmark results? I'd hate for people to be confused by them. |
|
Regarding OptCarrot, have you seen https://github.com/mame/optcarrot/blob/master/bin/optcarrot-bench-parallel-on-ractor ? That seems like a nice way to make OptCarrot Ractor-compatible without copying many files. I think it's best to avoid large copies in the repo, and |
|
Looks good to me.
What was the change? The diff is so large that GitHub doesn't show the diff.
If this is possible, I guess we could let |
|
Thanks @k0kubun @eregon I hadn't seen the Optcarrot ractor script yet. I'll work on integrating that instead 👍 |
|
Ok. Branch has been updated with revised Optcarrot Ractor benchmark. Thanks all. |
|
I gave it a try and made The only "copied" benchmark is then knucleotide, and that seems fine as-is because it's pretty small and has significant differences with the fork-based version in |
|
One more thought is the additions of |
|
I went through the diff, LGTM in general. |
ccdb04c to
2899c09
Compare
Co-Authored-By: Luke Gruber <[email protected]> Co-Authored-By: Étienne Barrié <[email protected]>
Committed seperately so the noisy diff can be easily excluded from reviews if needed.
These can be run as follows: ruby -Iharness-ractor/harness.rb benchmarks-ractor/json_parse_float/benchmark.rb Co-Authored-By: Luke Gruber <[email protected]>
Co-Authored-By: Luke Gruber <[email protected]>
If your ruby's bundler is different from the saved result in `Gemfile.lock`, bundler autoswitches by starting a new process. When it does this it sometimes doesn't pick up the old LOAD_PATH and results in a LoadError. Switch to use `Bundler.setup`, which is a simpler process and uses the current bundler.
2 implementations, one using Process.fork, and one using Ractors - for comparison
This is a copy of the Optcarrot benchmark from benchmarks/optcarrot, but modified to be compatible with multiple Ractors
Instead -Iharness-name can be used
This commit introduces a harness that can be used to chain two (or more) harnesses together. For example. To run a Ractor test with Vernier you can wrap the ractor harness with the vernier one as follows HARNESS_CHAIN="vernier,ractor" ruby -Iharness-chain benchmarks-ractor/optcarrot/benchmark.rb
This commit modifies the benchmark runner to add 2 new categories: --category=ractor-only Runs only those benchmarks in benchmarks-ractor using the Ractor harness. --category=ractor In addition to the ractor-only benchmarks, this will run benchmarks specified in benchmarks.yml with `ractor: true` using the Ractor harness. In addition to this we've modified the burn in and run once scripts to use the new harnesses and categories too Co-Authored-By: Luke Gruber <[email protected]>
2899c09 to
a278094
Compare
Also make sure that the benchmarks list test is up to date
a278094 to
e191c14
Compare
by defining it as a no-op in those cases.
This commit removes the need to copy any Optcarrot files, by using an approach based on the optcarrot-bench-parallel-on-ractor script included in Optcarrot, to make all necessary state shareable when the benchmark is running under the Ractor harness. Co-Authored-By: Matt Valentine-House <[email protected]>
|
Great, I saw the previous state, it removed the copy of the files so that seemed fine too to me but indeed, I think just |
JSON dictionary keys are always strings, so this benchmark could be seen to be misleading, as only the values are floats, the keys will be implicitly converted when the hash is converted to json. I've chosen to do use an array here instead of explicilty converting the keys into strings because it avoids the complexity of string interpolation, and it keeps the original intention of this micro benchmark which was to have all the contents of the data structure homogenous.
This PR introduces a set of benchmarks for assessing the performance of Ractors. The main parts of this work are
1. Introduce a set of Ractor specific performance benchmarks
A new harness
harness-ractor.rbhas been introduced. This harness will run the benchmark code inside a number of Ractors concurrently and collect timing information. By default this is 0 (ractors disabled), 1, 2, 4 and 8.A number of Ractor specific benchmarks designed to test specific scenarios of multi-ractor mode have been introduced into the
benchmarks-ractordirectory. They've also been included inbenchmarks.ymlwith the name prefixractor/.In order to run these benchmarks with the new harness a new category
ractor-onlyhas been introduced. The ractor only benchmarks can be run as follows:2. Adapt existing benchmarks to be Ractor compatible
Existing benchmarks in the
benchmarksdirectory have been updated (where it's possible to do so in a simple manner) to be multi-Ractor safe (mostly making sure any common state is made shareable usingRactor.make_shareable). Benchmarks that have been updated in this way have been marked insidebenchmarks.ymlwithractor: true.These tests can be run with either the normal benchmark harness or the Ractor harness, they should be expected to work with both.
A new category
ractorhas been introduced that will run all of these tests with the Ractor harness alongside the Ractor only tests mentioned above.All Ractor benchmarks can be run as follows:
Any benchmark can be run with the Ractor harness using the
run_once.shscript in conjunction with theHARNESSenvironment variableOr a category can be run using the
--harnessargument to the main benchmark runnerBut be aware that running like this will ignore the
ractorkey inbenchmarks.ymland will run all the chosen benchmarks with the ractor harness, regardless of compatibility. Crashes are likely.3. Harness chain.
For convenience and as an aid to profiling with ractors, this PR also implements the ability to chain harnesses together. For example, running the ractor-only benchmarks through the Vernier profiler can be done as follows: